<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="tags" tagdir="/WEB-INF/tags"%>

<!DOCTYPE html>
<html lang="zh-CN">
<tags:header></tags:header>

<body>
	<tags:navbar></tags:navbar>
	<div class="container-fluid">
		<div class="row-fluid">
			<tags:menu></tags:menu>
			<noscript>
				<div class="alert alert-block span10">
					<h4 class="alert-heading">Warning!</h4>
					<p>
						You need to have <a href="http://en.wikipedia.org/wiki/JavaScript"
							target="_blank">JavaScript</a> enabled to use this site.
					</p>
				</div>
			</noscript>

			<div id="content" class="span10">
				<div class="row-fluid sortable">
					<div class="box span12">
						<div class="box-header well" data-original-title>
							<h2>版本管理</h2>
							<div class="box-icon">
							<a href="#" class="btn btn-setting btn-round"><i class="icon-plus"></i></a>
							<a href="#" class="btn btn-minimize btn-round"><i class="icon-chevron-up"></i></a>
							<a href="#" class="btn btn-close btn-round"><i class="icon-remove"></i></a>
						</div>
						</div>
						<div class="box-content">
							<table
								class="table table-striped table-bordered bootstrap-datatable datatable">
								<thead>
									<tr>
										<th>ID</th>
										<th>Version Code</th>
										<th>Version Name</th>
										<th>Force</th>
										<th>Download Path</th>
										<th>操作</th>
									</tr>
								</thead>
								<tbody>
									<c:forEach var="item" items="${items}">
									<tr>
										<td>${item.id}</td>
										<td class="center">${item.versionCode }</td>
										<td class="center">${item.versionName }</td>
										<td class="center">
											${item.forced }
										</td>
										<td class="center">${item.downloadPath }</td>
										<td class="center"><a class="btn btn-success" target="blank" href="/pm/get.json?id=${item.id}">
												<i class="icon-zoom-in icon-white"></i> View
										</a> <a class="btn btn-info" href="#"> <i
												class="icon-edit icon-white"></i> Edit
										</a> <a class="btn btn-danger" href="#"> <i
												class="icon-trash icon-white"></i> Delete
										</a></td>
									</tr>
									</c:forEach>
								</tbody>
							</table>
						</div>
					</div>
				</div>

				<!-- content ends -->
			</div>
			<!--/#content.span10-->
		</div>
		<!--/fluid-row-->

		<hr>
		<div class="modal hide fade" id="myModal">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal">×</button>
				<h3>New version</h3>
			</div>
			<div class="modal-body">
				<div class="row-fluid sortable">
					<div class="box span12">
						<div class="box-content">
							<form class="form-horizontal"  method="post" id="myForm">
							  <fieldset>
								<div class="control-group">
								  <label class="control-label" for="versionCode">Version Code </label>
								  <div class="controls">
									<input type="text" class="input-xlarge" name="versionCode" id="versionCode" >
								  </div>
								</div>
								<div class="control-group">
								  <label class="control-label" for="versionName">Version Name</label>
								  <div class="controls">
									<input type="text" class="input-xlarge" name="versionName" id="versionName">
								  </div>
								</div>
								<div>
									<label class="control-label" for="force">Force</label>
									<div class="controls">
										<label class="checkbox">
											<input type="checkbox" name="forced" id="forced" value="1">
								  		</label>
									</div>
								</div>
								<div class="control-group">
								  <label class="control-label" for="downloadPath">Download Path</label>
								  <div class="controls">
									<input type="text" class="input-xlarge" name="downloadPath" id="downloadPath" >
								  </div>
								</div>          
								<div class="control-group">
								  <label class="control-label" for="des">Description</label>
								  <div class="controls">
									<textarea id="des" rows="3" name="des"></textarea>
								  </div>
								</div>
							  </fieldset>
							</form>   
	
						</div>
					</div><!--/span-->

				</div><!--/row-->
			</div>
			<div class="modal-footer">
				<a href="#" class="btn" id="a_close" data-dismiss="modal">Close</a>
				<a href="#" class="btn btn-primary">Save changes</a>
			</div>
		</div>
		<tags:footer></tags:footer>

	</div>
	<!--/.fluid-container-->

	<tags:footer_scripts></tags:footer_scripts>
	<script type="text/javascript">
	$('.btn.btn-primary').click(function (){
		alert($('#myForm').serialize())
		$.ajax({    
	        type:'post',        
	        url:'/admin/pm/save.json',    
	        data:$('#myForm').serialize(),    
	        cache:false,    
	        dataType:'json',    
	        success:function(data){
	        	$('#a_close').click()
	        	location.reload();
	        }    
	    });  
		  
	});
	</script>
</body>
</html>
